/**
 * 
 */
package com.alphasystem.commerce.model.config;

import static javax.persistence.FetchType.EAGER;
import static javax.persistence.InheritanceType.JOINED;

import java.util.LinkedHashMap;
import java.util.Map;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.JoinColumn;
import javax.persistence.MapKeyJoinColumn;
import javax.persistence.Table;

/**
 * @author Syed Farhan Ali
 * 
 */
@Entity
@Table(name = "MAP_CONFIG")
@Inheritance(strategy = JOINED)
public class MapConfiguration extends AbstractConfiguration {

	private static final long serialVersionUID = 1726387389909319394L;

	protected Map<String, String> values;

	public MapConfiguration() {
		this(TEMP_ID);
	}

	public MapConfiguration(String id) {
		super(id);
		values = new LinkedHashMap<String, String>();
	}

	@ElementCollection(fetch = EAGER)
	@CollectionTable(name = "MAP_VALUES", joinColumns = @JoinColumn(name = "CONFIG_ID"))
	@MapKeyJoinColumn(name = "KEY")
	@Column(name = "VALUE")
	public Map<String, String> getValues() {
		return values;
	}

	public void setValues(Map<String, String> values) {
		this.values = values;
	}

}
